import random
import string


def generateRandomTextList(prefix: str, repeat: bool = True, amount: int = random.randint(10, 20)) -> list[str]:

    if repeat:
        # 生成一个包含26个不重复字母的列表
        return [prefix + letter for letter in random.sample(string.ascii_letters, k=amount)]  # 在前面加上用户设定的前缀
    else:
        # 允许重复
        return [prefix + letter for letter in random.choices(string.ascii_letters, k=amount)]  # 在前面加上用户设定的前缀


def generateRandomNumberList(amount: int = random.randint(10, 20)) -> list[int]:
    return [random.randint(0, 9) for _ in range(amount)]


def generateMatrix(m: int = random.randint(5, 16), n: int = random.randint(5, 16)) -> list[list[int]]:
    return [generateRandomNumberList(m) for _ in range(n)]


def generateRandomInt(min_num: int, max_num: int) -> int:
    return random.randint(min_num, max_num)


def generateTextListFromList(text_lists: list[str], amount: int, repeat: bool = True) -> list[
    str]:
    if repeat:
        return random.choices(text_lists, k=amount)
    return random.sample(text_lists, k=amount)
